# Makefile for uClibc
#
# Copyright (C) 2000 by Lineo, inc.
# Copyright (C) 2000-2005 Erik Andersen <andersen@uclibc.org>
#
# Licensed under the LGPL v2.1, see the file COPYING.LIB in this tarball.
#

MSRC:=ctype.c
MOBJ:=	isalnum.o isalpha.o isascii.o iscntrl.o isdigit.o \
	isgraph.o islower.o isprint.o ispunct.o isspace.o \
	isupper.o isxdigit.o toascii.o tolower.o toupper.o \
	isblank.o isxlower.o isxupper.o

ifeq ($(UCLIBC_HAS_CTYPE_TABLES),y)
MOBJ+=	__C_ctype_b.o __C_ctype_tolower.o __C_ctype_toupper.o \
	__ctype_b_loc.o __ctype_tolower_loc.o __ctype_toupper_loc.o \
	__ctype_assert.o isctype.o
endif

MOBJx:=	isalnum_l.o isalpha_l.o isascii_l.o iscntrl_l.o isdigit_l.o \
	isgraph_l.o islower_l.o isprint_l.o ispunct_l.o isspace_l.o \
	isupper_l.o isxdigit_l.o toascii_l.o tolower_l.o toupper_l.o \
	isblank_l.o # isxlower_l.o isxupper_l.o

MISC_CTYPE_DIR:=$(top_srcdir)libc/misc/ctype
MISC_CTYPE_OUT:=$(top_builddir)libc/misc/ctype

MISC_CTYPE_MSRC:=$(MISC_CTYPE_DIR)/$(MSRC)
MISC_CTYPE_MOBJ:=$(patsubst %.o,$(MISC_CTYPE_OUT)/%.o,$(MOBJ))
MISC_CTYPE_MOBJx:=$(patsubst %.o,$(MISC_CTYPE_OUT)/%.o,$(MOBJx))

MISC_CTYPE_DEF:=$(patsubst %,-DL_%,$(subst .o,,$(notdir $(MISC_CTYPE_MOBJ))))

$(MISC_CTYPE_MOBJ): $(MISC_CTYPE_MSRC)
	$(compile.m)

$(MISC_CTYPE_MOBJ:.o=.os): $(MISC_CTYPE_MSRC)
	$(compile.m)

$(MISC_CTYPE_MOBJx): $(MISC_CTYPE_MSRC)
	$(compile.m) -D__UCLIBC_DO_XLOCALE

$(MISC_CTYPE_MOBJx:.o=.os): $(MISC_CTYPE_MSRC)
	$(compile.m) -D__UCLIBC_DO_XLOCALE

libc-a-y+=$(MISC_CTYPE_MOBJ)
libc-a-$(UCLIBC_HAS_XLOCALE)+=$(MISC_CTYPE_MOBJx)
libc-so-y+=$(MISC_CTYPE_MOBJ:.o=.os)
libc-so-$(UCLIBC_HAS_XLOCALE)+=$(MISC_CTYPE_MOBJx:.o=.os)

CFLAGS-multi-y+=$(MISC_CTYPE_DEF)
libc-multi-y+=$(MISC_CTYPE_MSRC)
libc-nomulti-$(UCLIBC_HAS_XLOCALE)+=$(MISC_CTYPE_MOBJx)

objclean-y+=misc_ctype_objclean

misc_ctype_objclean:
	$(RM) $(MISC_CTYPE_OUT)/*.{o,os}
